package com.weipai.education.dao.impl;

import com.weipai.education.dao.ActivityDao;
import com.weipai.education.mapper.ActivityMapper;
import com.weipai.education.model.Activity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2018/12/11 10:29
 */
@Repository
public class ActivityDaoImpl implements ActivityDao {
    
    @Autowired
    private ActivityMapper activityMapper;

    @Override
    public List<Map<String, Object>> list(Integer start, Integer size, Integer isAudit, 
                                          Integer activityCateId, String key, String userID) {
        return activityMapper.list(start, size, isAudit, activityCateId, key, userID);
    }

    @Override
    public Integer listAmount(Integer isAudit, Integer activityCateId, String key, String userID) {
        return activityMapper.listAmount(isAudit, activityCateId, key, userID);
    }

    @Override
    public int update(Activity activity) {
        return activityMapper.updateByPrimaryKeySelective(activity);
    }

    @Override
    public int insert(Activity activity) {
        return activityMapper.insert(activity);
    }

    @Override
    public Activity selectByPrimaryKey(String id) {
        return activityMapper.selectByPrimaryKey(Integer.parseInt(id));
    }

    @Override
    public int batchDeleteById(String[] id) {
        return activityMapper.batchDeleteById(id);
    }

    @Override
    public int getActivityByCateId(String cateId) {
        return activityMapper.getActivityByCateId(cateId);
    }
}
